From c5237eabeb5ca451354d58a8181013ed1001695e Mon Sep 17 00:00:00 2001 From: Nicolas BESNARD Date: Thu, 10 Apr 2025 08:51:54 +0000 Subject: [PATCH] odhcp6c: prevent RELEASE at shutdown when -k is set MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Problem: Based on the README, if -k option is set, a RELEASE message should not be sent when the process is stopped. RELEASE messages are also not sent in case of a forced RELEASE or reconfiguration, however. Solution: Stop the transmission of RELEASE messages when the process is stopped but allow it for a forced RELEASE or reconfiguration. Signed-off-by: Nicolas BESNARD Signed-off-by: Paul Donald Link: https://github.com/openwrt/odhcp6c/pull/106 Signed-off-by: Álvaro Fernández Rojas --- src/odhcp6c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/odhcp6c.c b/src/odhcp6c.c index ac54ec7..b66c5c3 100644 --- a/src/odhcp6c.c +++ b/src/odhcp6c.c @@ -698,13 +698,13 @@ int main(_unused int argc, char* const argv[]) notify_state_change("unbound", 0, true); } - if (server_id_len > 0 && (ia_pd_len > 0 || ia_na_len > 0) && config_dhcp->release) + if (server_id_len > 0 && (ia_pd_len > 0 || ia_na_len > 0) && (!signal_term || config_dhcp->release)) dhcpv6_send_request(DHCPV6_MSG_RELEASE); odhcp6c_clear_state(STATE_IA_NA); odhcp6c_clear_state(STATE_IA_PD); - if (!signal_usr2) { + if (signal_term) { terminate = true; } else { signal_usr2 = false; -- 2.30.2